package cn.edu.seu.ssny.aspect;

import cn.edu.seu.ssny.annotation.Operation;
import cn.edu.seu.ssny.controller.BaseController;
import cn.edu.seu.ssny.entity.OperationLog;
import cn.edu.seu.ssny.service.IOperationLogService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * 记录操作日志的切面
 */
@Component
@Aspect
@Slf4j
public class RecordOperationLogAspect extends BaseController {

    @Autowired
    private IOperationLogService operationLogService;

    /**
     * 功能描述:
     * <为所有被@Operation注解过的方法增加切面，即切点为注解@Operation
     *
     * @param joinPoint
     * @param operation
     * @return
     */
    @Around("@annotation(operation)")
    public Object log(ProceedingJoinPoint joinPoint, Operation operation) {
        String operationTypeName = operation.operationType().value();
        OperationLog operationLog = new OperationLog();
        return null;
    }
}
